#!/usr/bin/env ruby

LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME)))

require "#{LKP_SRC}/lib/tests/stats"

stats = LKP::Stats.new

while (line = $stdin.gets)
  case line
  when /([\d.]+:) (.*): FAILED!$/
    stats.add_test_result line, $2, 'fail'
  when /([\d.]+:) (.*): Ok$/
    stats.add_test_result line, $2, 'pass'
  when /([\d.]+:) (.*): (Skip$|Skip .*)/
    stats.add_test_result line, $2, 'skip'
  when /ignored_by_lkp: (.*)/
    stats.add_test_result line, $1, 'ignored_by_lkp'
  when /make perf failed/
    stats.add_test_result line, 'perf', 'make_fail'
  end
end

stats.dump
